//
//  BaseViewController.swift
//  maopu
//
//  Created by 黄海波 on 2017/4/6.
//  Copyright © 2017年 maopu. All rights reserved.
//

import UIKit

class BaseViewController: UIViewController {
    var navigationTitle:String = ""{
        didSet{
            if self.navigationController != nil{
                self.navigationItem.title = navigationTitle
            }
        }
    }
    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func viewDidLoad() {
        super.viewDidLoad()

        self.view.backgroundColor = UIColor.m_viewBackgroundColor()
        if self.navigationController != nil{
            self.navigationItem.leftBarButtonItem = UIBarButtonItem.setBackBarButton(action: #selector(self.goBack), target: self)
        }
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    
    func goBack(){
        _ = self.navigationController?.popViewController(animated: true)
    }
    
    
    
}
